var t = getApp();

Page({
  data: {
    text: "已开启",
    authStateBoo: !0,
    show: !1,
    input: ""
  },
  bindTextAreaBlur: function(t) {
    console.log(t.detail.value), this.setData({
      input: t.detail.value
    });
  },
  switch1Change: function(a) {
    var that = this
    var type = a.detail.value
    if (type == true) {
      var gzstype = 1
      this.setData({
        text: "已开启",
        show: !1
      })
    } else {
      var gzstype = 0
      this.setData({
        text: "已关闭",
        show: !0
      })
    }
    var zid = that.data.zid
    //改变工作室状态
    t.util.request({
      'url': 'entry/wxapp/Updoczt',
      data: {
        zid: zid,
        gzstype: gzstype,
      },
      success: function(res) {
        console.log(res)
      },
      fail: function(err) {
        console.log(err)
      },
    })
    // var e = wx.getStorageSync("log") || "",
    //   o = this;
    // 1 == a.detail.value ? (this.setData({
    //   text: "已开启",
    //   show: !1
    // }), wx.request({
    //   url: t.globalData.dic + "doctor/activeFlag/update",
    //   data: {
    //     token: e,
    //     activeFlag: 1
    //   },
    //   method: "POST",
    //   header: {
    //     "Content-Type": "application/x-www-form-urlencoded"
    //   },
    //   success: function(t) {
    //     console.log(t), o.setData({
    //       show: !1
    //     });
    //   }
    // })) : this.setData({
    //   text: "已关闭",
    //   show: !0
    // });
  },
  abolish: function(a) {
    var e = wx.getStorageSync("log") || "",
      o = this;
    wx.request({
      url: t.globalData.dic + "doctor/activeFlag/update",
      data: {
        token: e,
        activeFlag: 0
      },
      method: "POST",
      header: {
        "Content-Type": "application/x-www-form-urlencoded"
      },
      success: function(t) {
        console.log(t), o.setData({
          show: !1
        });
      }
    });
  },
  confirm: function(e) {
    var that = this
    var gbyuanyin = that.data.input
    var zid = that.data.zid
    console.log(zid, gbyuanyin)
    //改变工作室状态
    t.util.request({
      'url': 'entry/wxapp/Updoczt',
      data: {
        zid: zid,
        gbyuanyin: gbyuanyin,
        gzstype: 0,

      },
      success: function(res) {
        that.setData({
          show: !1
        })
      },
      fail: function(err) {
        console.log(err)
      },
    })
    // var e = wx.getStorageSync("log") || "",
    //   o = this;
    // wx.request({
    //   url: t.globalData.dic + "doctor/activeFlag/update",
    //   data: {
    //     token: e,
    //     activeFlag: 0,
    //     stopMedNotify: o.data.input || ""
    //   },
    //   method: "POST",
    //   header: {
    //     "Content-Type": "application/x-www-form-urlencoded"
    //   },
    //   success: function(t) {
    //     o.setData({
    //       show: !1
    //     });
    //   }
    // });
  },
  onLoad: function(a) {
    // var e = wx.getStorageSync("log") || "",
    //   o = this;
    // wx.request({
    //   url: t.globalData.dic + "doctor/personal/info/get/" + e,
    //   success: function(t) {
    //     console.log(t.data.data), o.setData({
    //       input: t.data.data.stopMedNotify
    //     }), 0 == t.data.data.activeFlag ? o.setData({
    //       authStateBoo: !1,
    //       text: "已关闭"
    //     }) : o.setData({
    //       authStateBoo: !0,
    //       text: "已开启"
    //     });
    //   }
    // });


  },
  onReady: function() {
    var that = this
    t.util.request({
      'url': 'entry/wxapp/Myzhuan',
      data: {
        openid: wx.getStorageSync('openid')
      },
      success: function(res) {
        if (res.data.data.gzstype == 1) {
          var text = "已开启"
          that.setData({
            zid: res.data.data.zid,
            gzstype: text,
            authStateBoo: !0,
          })
        } else {
          that.setData({
            zid: res.data.data.zid,
            authStateBoo: !1,
            text: "已关闭"
          })
        }
      },
      fail: function(err) {
        console.log(err)
      },
    })
    t.util.request({
      'url': 'entry/wxapp/Base',
      success: function(res) {
        console.log(res)
        that.setData({
          yy_telphone: res.data.data.yy_telphone
        })
      },
      fail: function(err) {
        console.log(err)
      },
    })
  },
  onShow: function() {},
  phoneCall: function(e) {
    var phoneNumber = e.currentTarget.dataset.yy_telphone
    wx.makePhoneCall({
      phoneNumber: phoneNumber
    });
  },

});